
package com.faithbj.device.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.faithbj.device.dao.DeviceInfoDao;
import com.faithbj.device.dao.impl.DeviceInfoDaoImpl;
import com.faithbj.device.model.configuration.Pager;
import com.faithbj.device.model.entity.DeviceInfo;
import com.faithbj.device.service.DeviceInfoService;

/**
 * @author jrn E-mail: rinanjin@gmail.com
 * 
 * @version 0.1 
 * 
 * <br/>创建时间：2012-5-15 下午08:27:00
 * 
 * <br/>类说明
 */
@Service("deviceInfoService")
public class DeviceInfoServiceImpl extends BaseServiceImpl<DeviceInfo, String> implements DeviceInfoService
{
	@Resource(name="deviceInfoDao")
	private DeviceInfoDaoImpl deviceInfoDao;
	
	@Resource(name="deviceInfoDao")
	public void setDeviceInfoDao(DeviceInfoDaoImpl deviceInfoDao)
	{
		this.deviceInfoDao = deviceInfoDao;
	}
	
	@Resource
	public void setBaseDao(DeviceInfoDao deviceInfoDao)
	{
		super.setBaseDao(deviceInfoDao);
	}

	@Override
	public String save(DeviceInfo deviceInfo)
	{
		String id = deviceInfoDao.save(deviceInfo);
		deviceInfoDao.flush();
		deviceInfoDao.evict(deviceInfo);
		deviceInfo = deviceInfoDao.load(id);
		return id;
	}

	@Override
	public void delete(String id) 
	{
		deviceInfoDao.delete(id);
		deviceInfoDao.flush();
	}
	
	@Override
	public void batchDelete(String[] ids)
	{
		deviceInfoDao.delete(ids);
		deviceInfoDao.flush();
	}

	@Override
	public DeviceInfo get(String id)
	{
		DeviceInfo deviceInfo = deviceInfoDao.get(id);
		deviceInfoDao.clear();
		return deviceInfo;
	}

	@Override
	public Pager findByPager(Pager pager, DeviceInfo deviceInfo)
	{
		return deviceInfoDao.findByPager(pager, deviceInfo);
	}
}
